﻿@{
    ViewBag.Title = Model.UserID > 0 ? L("Ribbon_EditUser") : L("Ribbon_CreateUser");
}

@model User

@Html.HiddenFor(m=>m.UserID)
@Html.TextBoxExFor(mbox=>mbox.UserName, new{
    data_val_regex_pattern=Consts.UserNameRegex,
    data_val_regex=L(CreateUserStatus.UserNameInvalid), 
    data_val_required=L(CreateUserStatus.UserNameNotNull),
    data_val_remote=L(CreateUserStatus.DuplicateUserName),
    data_val_remote_url=Url.Action("CheckUserName"),
    data_val_remote_additionalfields="*.UserName,*.UserID"
}) 
@Html.TextBoxExFor(m => m.DisplayName, new { 
    data_val_remote=L(CreateUserStatus.DuplicateDisplayName),
    data_val_remote_url=Url.Action("CheckDisplayName"),
    data_val_remote_additionalfields="*.DisplayName,*.UserID"
})
@if (Model.UserID > 0) { 
    @Html.PasswordExFor(m=>m.Password, new{
        data_val_regex_pattern=Consts.PasswordRegex,
        data_val_regex=L(CreateUserStatus.PasswordInvalid)
    })
}else{
    @Html.PasswordExFor(m=>m.Password, new{
        data_val_regex_pattern=Consts.PasswordRegex,
        data_val_regex=L(CreateUserStatus.PasswordInvalid), 
        data_val_required=L(CreateUserStatus.PasswordNotNull)
    })
}
@Html.PasswordEx("ConfirmPassword", new { 
    data_val_equalTo=L(CreateUserStatus.PasswordNotEqualConfirm), 
    data_val_equalto_other="*.Password"
})
@Html.TextBoxExFor(mbox => mbox.Email, new
{
    data_val_email = L(CreateUserStatus.EmailInvalid),
    data_val_required = L(CreateUserStatus.EmailNotNull)
}) 
 
<div class="lineinput">
    @Html.LabelExFor(m=>m.RoleLevel)
    @Html.EnumDropdownListFor(m=>m.RoleLevel, RoleLevel.Anonymous, Self.RoleLevel, new{@class="kendoui"})
    <p></p>
</div>
@if (Model.UserID > 0)
{ 
    @Html.EnumDropdownListExFor(m=>m.AccountStatus)
}
    
@Html.ButtonEx()

@section head{
    @Scripts.Render("~/scripts/jqueryval")
}